import type {UserBriefType, UserTraceStatType} from "@/types/user";
import {request} from "@/utils/http";
import type {PageQueryType, PageResultType} from "@/types/global";
import type {ProductItemSelectableType} from "@/types/product";

export const getUserInfo = () => {
    return request<UserBriefType>({
        url: '/user/info',
        method: 'GET'
    })
}
/**
 * 获取用户的收藏、足迹的统计数据
 */
export const getUserTrace = () => {
    return request<UserTraceStatType>({
        url: "/user/trace",
        method: "GET"
    })
}
/**
 * 获取用户收藏商品的列表数据
 * @param page
 */
export const getUserCollectProductList = (page: PageQueryType) => {
    return request<PageResultType<ProductItemSelectableType>>({
        url: "/collect-product/list",
        method: "POST",
        data: page
    })
}
/**
 * 获取用户浏览过的商品列表数据
 * @param page
 */
export const getUserHistoryProductList = (page: PageQueryType) => {
    return request<PageResultType<ProductItemSelectableType>>({
        url: "/history-product/list",
        method: "POST",
        data: page
    })
}